package 线程的学习;

public class YieldThread extends Thread{
    public void run(){
        for(int i=0;i<10;i++){
            System.out.println("当前线程名称是："+currentThread().getName()+"线程优先级是："+currentThread().getPriority());
            yield();
        }
    }
    public static void main(String args []){
//        Thread t1=new Thread(new YieldThread());
        YieldThread y1=new YieldThread();
        YieldThread y2=new YieldThread();
        y1.start();
        y2.start();

    }
}
